package jmine.tec.scheduling;

import bancosys.tec.exception.LocalizedMessageHolder;
import bancosys.tec.exception.MessageCreator;
import bancosys.tec.exception.MessageCreatorHelper;

/**
 * @author lundberg
 */
public enum SchedulingMessages implements MessageCreator {
    CONDITION_MASTER_MET(1, "jmine.tec.scheduling.condition.master.met"),

    CONDITION_MASTER_NOT_MET(1, "jmine.tec.scheduling.condition.master.not.met"),

    CONDITION_ALWAYS(0, "jmine.tec.scheduling.condition.always"),

    STATUS_EXECUTED(0, "jmine.tec.scheduling.status.executed"),

    STATUS_NOT_EXECUTED(0, "jmine.tec.scheduling.status.not.executed"),

    STATUS_FAILED(0, "jmine.tec.scheduling.status.failed"),

    VALIDATION_BEAN_DOES_NOT_EXIST(1, "jmine.tec.scheduling.validation.bean.does.not.exist"),

    VALIDATION_INCORRECT_BEAN_TYPE(2, "jmine.tec.scheduling.validation.incorrect.bean.type"),

    ERROR_SCHEDULING_JOB(1, "jmine.tec.scheduling.manager.error.scheduling.job"),

    ERROR_CREATING_TRIGGER_INVALID_CRON_EXPRESSION(2, "jmine.tec.scheduling.manager.error.creating.trigger.invalid.cron.expression"),

    ERROR_DELETING_JOB(1, "jmine.tec.scheduling.manager.error.deleting.job");

    private final MessageCreator creator;

    /**
     * Constructor
     * 
     * @param nargs nargs
     * @param key key
     */
    private SchedulingMessages(int nargs, String key) {
        this.creator = MessageCreatorHelper.creator("jmine-tec-scheduling-messages", key, nargs);
    }

    /**
     * {@inheritDoc}
     */
    public LocalizedMessageHolder create(Object... arguments) {
        return this.creator.create(arguments);
    }

    /**
     * {@inheritDoc}
     */
    public int getExpectedArguments() {
        return this.creator.getExpectedArguments();
    }

}
